<h5>Burning  a bootloader into a brand new DIP atmega168/328part to use it with Wiring</h5>
<p>This tutorial introduces how to burn a bootloader from scratch of an atmega168/328 DIP package microcontroller on a breadboard to use it with Wiring.</p>
<h5>Step 1</h5>
<p>Setup the basic circuit to use the atmega168/328. The Wiring board shown in this tutorial will be used as programmer to burn the bootloader into the atmega168/328 DIP part. It is possible to use other board as the programmer all you have to do is to find the SS, SCK, MISO and MOSI pins on it to properly connect them to the atmega 168/328 DIP part.</p>
<p><img src="imgs/atmega168-328.png" width="548" height="1016" /></p>
<p>Note how the Power LED, and its resistor r3, the Blink LED and its resistor r2 are optional, they are useful for you to know of your circuit has power and later.</p>
<p>The Pulse switch is also optional, it will be used for manual reset of your DIP part.</p>
<p>The atmega168/328 can be used at 16Mhz requiring the XTAL and the two capacitors C1 and C2, we used (10 1KV) value for C1 and C2 and worked very well although the datasheet recommends to use 22pF for C1 and C2.</p>
<h5>Step 2</h5>
<p>Select the appropriate board you are going to use as programmer, for the purpose of this tutorial we used the Wiring S board, select the one you are planning to use on the menu Tools &raquo; Board &raquo; Wiring &raquo; Wiring S @ 16 MHz</p>
<h5>Step 3</h5>
<p>Select the appropriate Serial port for your board, for our setup the port selected in the menu was Tools &raquo; Serial Port &raquo; /dev/tty.usbserial-A400f7EN, find the right one for your programmer board.</p>
<h5>Step 4</h5>
<p>Load the WiringISP sketch located in the menu Help &raquo; Examples &raquo; Basics &raquo; WiringISP</p>
<h5>Step 5 </h5>
<p>Upload the sketch into the programmer board pressing the Upload button on the main toolbar. Now your board will act as a programmer to burn the bootloader into a target microcontroller.</p>
<h5>Step 6 </h5>
<p>Select the target microcontroller, for the purpose of this example we used an atmega168 part @ 16 MHz, in the menu Tools &raquo; Board &raquo; Atmel &raquo; ATmega168 @ 16MHz (crystal). If you are using a different DIP part select the one you have at the right speed.</p>
<h5>Step 7</h5>
<p>Select the menu Tools &raquo; Burn Bootloader &raquo; w/ Wiring ISP (use WiringISP sketch on another board) and this will start burning the new bootloader into your atmega168/328 DIP part. </p>
<p>After a few minutes a message telling burning bootloader was successful will be shown in the message box or an error message if the process failed. Errors might show if  there are problems in the connections.</p>
<p>&nbsp;</p>
<p>Next &gt;&gt; <a href="../atmegaDIP">Using an FTDI USB to Serial breakout board to  program your new chip using Wiring</a></p>
